package mytool;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;

import mytool.jsonpackage.RootCode;


public class JsonParser {

    // About APP

    public static Boolean CheckCode(String json) {
        if (json == null || json.length() <= 0) return false;
        RootCode root = JSON.parseObject(json, new TypeReference<RootCode>() {
        });
        Boolean flag = true;

        if (root.msg.equals("success")) {
            return true;
        }

        if (root.code != null && root.msg.equals("错误代码")) {
            return false;

        }
        if (root.code != null && root.msg.equals("未登录")) {
            return false;

        }
        if (root.code != null && root.msg.equals("系统异常")) {
            return false;
        }


        return flag;
    }


    public static RootCode getAppli(String json) {

        return JSON.parseObject(json, new TypeReference<RootCode>() {
        });
    }



}
